home *** CD-ROM | disk | FTP | other *** search
- howard daniel joseph wrote:
- >
- > Okay. I'm writing a program under GCC on my Amiga.
- >
- > But I'm confused to hell over integer limits.
- >
- > My book talks about 2 bit and 4 bit integers ... and four bit
- > integers like what it describers long integers to be. Of course there's
- > unsigned integers and the like too.
- >
- I think it should be 2 bytes integer which his 16 bits or 4 bytes integer
- which has 32 bits.
-
- > How do I declare signed versus unsigned integers?
-
- int x; // signed
- unsigned int x; // unsigned
- >
- > How do I know how many bits my integers are using?
- sizeof(int); will give you the bytes your integers are using.
-
- >
- > How do I declare signed and unsigned long integers?
- long x; // signed
- unsigned logn x; // unsigned
-
- >
- > What's with these "doubles" the book mysteriously alludes to?
- >
- If you happen to know something about the data representation inside
- computer, you will understand why.
-
- > What *am* I creating when I type;
- >
- > int somevalue;
- > (ie Is it signed/unsigned? How many bits?)
- signed, but the size is determined by your computer and your compiler.
- On the sun workstations in the lab, the size is four bytes or 32 bits.
-
- >
- > I know many of the answers here, but if I could get them all from one
- > source I'd feel a lot better.
- >
- > I need two sorts of values for my project;
- >
- > An integer (unsigned) that can handle, 6, though ideally 9 places (Just
- > under 250000000 would be the maximum forseen possible value here.)
-
- The largest unsigned int is 65536*65536 - 1.
- >
- > An integer that can handle a much bigger number ... 12 places at least for
- > now.
- >
- > Can I perform simple maths (addition, division) between integers of
- > different types? I'd assume so, right?
- Yes, you can. But they will be converted according to the order of the
- evaluation of the expression. You may lose precision sometimes.
-
- Mu Han
- >
- > --
- > =====///====================================================================
- > ====///=======This message brought to you by dannyman@uiuc.edu==============
- > \\\///=========HOME PAGE! http://www.uiuc.edu/ph/www/djhoward ==============
- > =\XX/A1200==================================================================
- > My views are my own, and not those of my employer or UIUC. Happy Jim?
-
-